<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class PluginNav extends Migration
{
    protected $_table = 'plugin_nav';
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        //
        Schema::create($this->_table, function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            $table->string('category',10)->default('')->comment('work - 工作, relax - 放松, explore - 探索');
            $table->string('ntype',10)->default('')->comment('item/dir');
            $table->integer('pid')->default(0)->unsigned();
            $table->string('display_name',50)->default('');
            $table->integer('user_id')->default(0)->unsigned();
            $table->string('address')->default('');
            $table->integer('priority')->default(0)->unsigned();
            //$table->boolean('is_active')->default(0);
            //$table->text('json')->nullable();
            $table->dateTime('created_at')->nullable();
            $table->dateTime('updated_at')->nullable();
            //$table->dateTime('deleted_at')->nullable();

            $table->index('category');
            $table->index('user_id');
            $table->index(['category','user_id','priority']);
        });

        DB::statement("ALTER TABLE `{$this->_table}` comment '网址导航表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        //Schema::dropIfExists($this->_table);
    }
}
